package com.vsoft.anti_fra;

import java.sql.Connection;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.vsoft.framework.core.BaseException;
import com.vsoft.framework.core.BusiObj;
import com.vsoft.framework.core.Configuration;
import com.vsoft.framework.core.db.DBGadgets;
import com.vsoft.framework.core.db.DBTrans;
import com.vsoft.framework.core.esb.ServiceBus;
import com.vsoft.framework.core.util.BOHelper;
import com.vsoft.framework.core.util.LogCollect;
import com.vsoft.framework.core.util.XMLUtil;
import com.vsoft.framework.server.servlet.SessionData;
import com.vsoft.framework.server.servlet.HttpUtil;
import com.vsoft.anti_fra.*;

public class TestQuery {

	private static Logger vLogger = Logger.getLogger(TestQuery.class);
	private static String vName = TestQuery.class.getName();
	private SessionData vSD = null;
	private String vDebugHome = "";
	private BusiObj				vInBO		=  new BusiObj();
	
	
	public static void main(String[] args)  {
	
		try{
			vLogger.info("---------------InitSystem-------------");
			Configuration.InitSystem();
			vLogger.info("---------------generate test data-------------");
			TestQuery t = new TestQuery();

			Connection conn = DBTrans.getConnection();
			t.vInBO.setConnection(conn);
/*			t.vInBO.setString("start_time", "2010-10-30 21:30:00");
			t.vInBO.setString("end_time", "2010-11-30 21:30:00");*/
			BusiObj				vInBO		=  new BusiObj();

			
			BusiObj				vInBO1		=  new BusiObj();
			
			//t.vInBO.setName("AF_SetBlackList");
			//t.vInBO.setName("AF_GetIvrCountByArea");
			vLogger.info("---------------run test data-------------");
			RuleConf server = new RuleConf();
			//server.execute(t.vInBO);
			vLogger.info("---------------Game Over-------------");
			//DBGadgets.check(conn);
			
			t.vInBO.setString("start_time", "2010-10-30 21:30:00");
			t.vInBO.setString("end_time", "2010-11-30 21:30:00");
			t.vInBO.setName("AF_GetIvrCountByArea");//
			//t.vInBO.setString("call_num", "18955179099");
			//t.vInBO.setName("AF_GetIvrCountByAreaCallnum");//
			//t.vInBO.setName("AF_GetIvrList");
			//t.vInBO.setName("AF_GetExpDetList");
			//t.vInBO.setString("cheatCountFlag", "1");//search_text
			t.vInBO.setString("pageRows", "40");//search_text
			t.vInBO.setString("search_text", "13");//
			t.vInBO.setString("search_type", "1");//
			t.vInBO.setString("only110_flag", "1");//
			t.vInBO.setString("totalRows", "144040");
			server.execute(t.vInBO);
			conn.rollback();
			conn.close();
		}
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		catch(BaseException e)
		{
			vLogger.error(e.ErrMethod);
			vLogger.error(e.SysMsg);
		}
			vLogger.info("---------------Game Over-------------");
	

		
	}
	private int  init()
	{
		int iRet = 0;
		vSD = new  SessionData();
		vSD.vRoleCode = new String[] {"1"};
		vSD.vStaffCode = "1";
		vSD.vStaffNo = "0001";
		vSD.vStaffName = "test";
		
	
		vDebugHome = System.getProperty("DEBUG_HOME");
		if (vDebugHome == null)
		{
			iRet = -1;
			vLogger.error("需要设置DEBUG_HOME环境变量来指定debug 文件所在的目录");
		}
		return iRet;
		
	}
	
}
